Tracking social provenance in chains of retweets

In the era of massive sharing of information, the term social provenance is used to denote the ownership, source or origin of a piece of information which has been propagated through social media. Tracking the provenance of information is becoming increasingly important as social platforms acquire more relevance as source of news. In this scenario, Twitter is considered one of the most important social networks for information sharing and dissemination which can be accelerated through the use of retweets and quotes. However, the Twitter API does not provide a complete tracking of the retweet chains, since only the connection between a retweet and the original post is stored, while all the intermediate connections are lost. This can limit the ability to track the diffusion of information as well as the estimation of the importance of specific users, who can rapidly become influencers, in the news dissemination. This paper proposes an innovative approach for rebuilding the possible chains of retweets and also providing an estimation of the contributions given by each user in the information spread. For this purpose, we define the concept of Provenance Constraint Network and a modified version of the Path Consistency Algorithm. An application of the proposed technique to a real-world dataset is presented at the end of the paper.


Introduction
The amount of information shared through social media is increasing in recent years, since they are becoming more popular than traditional media as source of news. Online newspapers, social networks, and content-sharing platforms are everyday flooded by multimedia content describing the world events of major interest. In this context Twitter is certainly one the mostly used source of information. It counts about 330 million monthly active users which span from individuals to official institutional accounts.
One of the main benefits introduced by this kind of media is that information can be shared and disseminated all over the network very easily. However, this introduces new problems related to the tracking of the information diffusion [1,2] and the origin (provenance) of the information. For this reason, beside to the concept of data provenance [3][4][5], the term social provenance [6] has been introduced to inform about the ownership, source or origins of a given piece of information that propagates in a social network.
Twitter provides two important means for increasing the spread of information shared through a post (called tweet): retweets and quotes. The difference between the two is essentially the fact that the former simply reposts a previous tweet without any modification, while the latter adds some specific comments to the original content. For this reason, a retweet is considered an endorsement of the original post, while a quote can both provide support or express a different idea.
In this scenario it is crucial to track the diffusion of information [1,2] as well as to estimate the importance of specific users in spreading the original message, for example with the aim of recommending friends and followers, or to infer users' interests, needs, and political leaning [7]. However, the Twitter API does not provide a complete description of a retweet propagation path: the only information carried by a retweet is a link to the original tweet, whereas possible intermediate steps are lost, since no information are stored about them [8]. In other words, second-order retweets are treated as retweets of the original tweet and the retweet chains are not represented.
In this paper we propose a method for rebuilding the complete retweet chain by considering both temporal relations between posts and social connections between users. It uses a methodology inspired by the Temporal Constraint Network [9], for the construction of the interaction graph, and a modified version of the Path Consistency Algorithm [10], for the constraint propagation. More specifically, we introduce the concept of Provenance Constraint Network (PCN) where nodes represent tweets (or retweets) and edges are authorship constraints. An authorship constraint is used to track the complete possible provenance of a retweet. It not only specifies the set of users which likely contribute to the current post through a previous tweet or retweet, but also assigns to each of them a degree of ownership. In other words, all possible contributions are estimated and weighted based on the temporal relations between posts and the social relations between users. The basic idea is that if a user u 1 posts a retweet RT 1 of a tweet T created by u, but the social connection between u 1 and u is weaker than the connection with the author u 2 of another retweet RT 2 of T older than RT 1 , then it is more likely that RT 1 originated from RT 2 rather than T .
Several techniques have been proposed in literature in order to generate retweet cascade graphs. However, all of them concentrate in the identification for each retweet of the most probable source connection, discarding all the other ones. Moreover, these approaches are not able to prevent the loss of important connections and this can be worsen by the absence of real benchmarks on which the proposed techniques can be validated and refined. Conversely, in this paper we propose a different approach, because we try to reconstruct all possible connections and weight them on the basis of temporal and social relations. In addition, the use of a constraint propagation approach allows us to propagate derived provenance information inside the network.
The overall contribution of the paper is manifold: (i) we introduce a formalism, called Provenance Constraint Network, for modeling the social and temporal connections among tweets, (ii) we propose a modified version of the propagation operations used by the Path Consistency Algorithm which deals with provenance information, (iii) we define a MapReduce implementation of the propagation algorithm which takes care of the semantical characteristics of a PCN in order to reduce the computational cost, and (iv) we introduce a set of metrics for evaluating the goodness of the obtained results in absence of a ground truth.
The remainder of the paper is organized as follows: Sect. 2 discusses some previous contributions about information propagation on Twitter, Sect. 3 provides a complete formalization of the addressed problem, Sect. 4 introduces the proposed solution from the construction of a PCN to the definition of a MapReduce version of the Path Consistency Algorithm, Sect. 5 reports some experiments performed on a real-world Twitter dataset about COVID posts, and finally Sect. 6 summarizes the obtained results and discusses some future extensions.

Related work
The problem of social provenance or information diffusion has been investigated only at conceptual level in [11]: the authors propose PROVE-SAID, a unified conceptual model that provides concepts and definitions to deal with information diffusion and provenance in heterogeneous environments. In [12] the authors propose a social provenance framework for Twitter data, modeled in the NoSQL graph database Neo4j, but they do not provide an algorithm to translate data produced by Twitter API into their model.
In [13,14] the authors propose mathematical models for predicting the retweet dynamics based on both temporal and social network information. In particular, in [13] the joint use of these two kinds of information is the one that produces the most reliable predictions about cascade dynamics, whereas in [14] the authors examine dynamics of tie strength, in terms of reciprocity, temporality, and context-awareness through social networks and propose a general model to predict the repliers and retweeters of a particular tweet considering friendship dynamics. For this reason, this paper proposes an approach based on both temporal and social information for deriving social provenance in retweet chains.
The method proposed in [8] for modeling retweet cascade graphs is based on the estimation of the interaction strength between each couple of users. Such metric is measured on the basis of the analysis of previous retweets, quotes and replies, as well as the consideration of the friend and follower sets. However, this method requires to retrieve for each group of retweets the most recent timeline of all involved users, and this can be a little cumbersome in extensive analysis. Other alternative techniques which consider the impact of the social relationships in the reconstruction of the retweet chains are described in [15,16]. However, these methods measure the strength of social relationships only in terms of retweet dynamics, but this is not a complete measure, since no intermediate steps are registered in a chain of retweets.
At the best of our knowledge, given an original tweet and a set of its retweets, the main objective of the techniques proposed in literature is to identify for each retweet its actual source (the original tweet or another retweet) by using some heuristics based on the time and social interaction between the users. However, all these techniques are prone to errors and some important connections can be lost, also due to the absence of a base truth. Conversely, in this paper we define a technique which tries to estimate the likelihood of each possible connection and maintain a complete network of them.
The proposed technique is sufficiently generic to be enriched with other criteria or approaches for defining the interaction strengths between pairs of users, such as location information [17], or tweeting behavior [18]. In other words, any sophisticated formula for computing the interaction strengths can be easily plugged in the propagation algorithm.
A related but inverse problem, is the identification of the source of a rumor in an online social network. In this case, we have to track of the information spread and we want to identify the common source of information that originates the rumor [19][20][21]. Conversely, in our case, we do not want to identify the source of the information, since it is the only knowledge that we have (i.e., the original tweet) and we want to identify the possible chain of spread (i.e., the network of transmission) which is lost in Twitter. However, the adopted approaches share some similarities with the one proposed in this paper, which is the application of a probabilistic approach and the use of additional contextual information, like the network topology (i.e., social connections) and the speed of spreading (i.e., temporal aspects).
An approach similar to the one proposed in this paper can be found in [22], in this case the aim was to identify and track the provenance of data and the ownership of information in the archaeological context. In this scenario, we do not have a spread of an identical piece of information among different network nodes, but we have an evolution of the original data or the combination of several knowledge in order to obtain a new one. Moreover, some degrees of vagueness are added and depend on the kind of data to be managed, not on the kind of connections in the network. Anyway, the idea to track all possible connections and give them a certain level of confidence are common to both approaches.

Problem formulation
This section provides a rigorous description of the considered problem. First of all, the concepts of tweet and user are formalized, then some observations are made about their possible connections, and finally the notion of authorship is introduced.
The term tweet is generically used to denote different kinds of posts, in particular: general tweets, retweets and the quotes. 1 While a general tweet is an original content produced by a well recognized user, retweets and quotes are two ways to re-post the content of another tweet. The difference between a retweet and a quote is that the latter allows to add a comment to the mentioned tweet. For the purposes of this paper, we can safely neglect this last distinction, so anytime we use the term retweet, we can refer to either a retweet or a quote without distinction.

Definition 1 (Tweet)
A tweet T can be briefly represented as a tuple id, user, timestamp, text, retweet_of , where id is a unique identifier for the tweet T , user is the identifier of the user who posted T , timestamp is post timestamp, text is the tweet content, and finally retweet_of is the identifier of the source tweet, if T is a retweet of another tweet T , or the empty value otherwise.
Notice that the last property is what allows us to distinguish a general tweet from a retweet: a tweet T is a retweet if and only if the property T .retweet_of is not empty.
Throughout the paper, the set of all tweets will be denoted as T , the set of all retweets as R, with R ⊂ T . Given a tweet T ∈ T , the set of retweets of T is denoted as T .R.

Definition 2 (User)
A user u can be synthetically represented by a tuple id, username, Followers, Friends , where Followers is the set of users that are following u, while Friends is the set of users that u is following. Fig. 1 Example of connection between a general tweet T and two of its retweets RT 1 and RT 2 . In the tuple T , u, t , T is the tweet identifier, u is the user identifier and t is the tweet timestamp. The solid arrows represent connections stored in the Twitter API, while the dashed arrow is a derived one The set of all users will be denoted as U. Given a user u ∈ U, u.Followers ⊆ U and u.Friends ⊆ U. Moreover, given two users u, w ∈ U, four different scenarios can be recognized: (i) w ∈ u · Followers ∧ w / ∈ u · Friends, w is following u but not vice versa, (ii) w ∈ u · Friends ∧ w / ∈ u · Followers, u is following w but not vice versa, (iii) w ∈ u · Followers ∧ w ∈ u · Friends, u and w are following each other, finally (iv) w / ∈ u · Followers ∧ w / ∈ u · Friends, u and w are not following each other at all. Let us consider the situation depicted in Fig. 1; in this case we have a general tweet T with two retweets RT 1 and RT 2 . Each tweet is represented by a node and an edge connects a retweet RT i to its original tweet T , so the edge represents the property RT i .retweet_of. The label of the node T , u, t includes only the id, user and timestamp of the tweet, respectively.
In accordance to what is stored by the Twitter platform, both RT 1 and RT 2 are connected only to the original general tweet T (see the two solid arrows from the retweets to the general tweet T ). However, the following observations can be made. 1 and RT 2 of the same general tweet T , if the author u 2 of RT 2 is a follower of the user u 1 , who is the author of RT 1 , and the timestamp t 2 of RT 2 is greater than the timestamp t 1 of RT 1 , then it is possible that RT 2 is a retweet of RT 1 , rather than a retweet of the original general tweet T .

Observation 3.1 Given two retweets RT
where RT . R is the estimated set of retweets of a retweet RT .
In Fig. 1, RT 1 . R is represented by the dashed edge connecting the node RT 2 with RT 1 . In the attempt to identify chains of retweets, previous proposals typically adopt strategies based on social network information (i.e., friends and followers) in conjunction with temporal information [23]; in particular they exploited the fact that users tend to interact more often with newer tweets [18], and thus, a user is more likely to retweet the last tweet of a friend [14]. Observation 3.2 Given a retweet RT 2 performed by a user u 2 at timestamp t 2 and related to an original general tweet T , and a set S of users such that namely the set of users which are followed by u 2 and have posted a retweet of T prior to u 2 . Then, the likelihood that RT 2 is a retweet of any RT i ∈ S depends on the cardinality of S and the distance between the timestamp of RT 2 and RT i . The rationale is that if more than one followed users have performed a retweet of the same tweet, it is more likely that u 2 has taken the last of them as source of RT 2 .
Another aspect to be considered is that the Twitter platform has recently changed its policies: it does not show content based on a simple reverse chronological order, but it also considers trend topics and their importance. More specifically, the likelihood that a retweet is a source of another retweet could depend on the connection (social interaction) between the two users.
where connections(u, u i ) is the set composed of all retweets, quotes and replies performed by u towards tweets from u i , and vice-versa.
Given the above three observations, we can define the concept of Provenance Constraint Network (PCN), which represents the first contribution of the paper.

Definition 3 (Provenance Constraint Network) A Provenance Constraint Network (PCN)
N is a tuple X , C , where X is a set of nodes representing tweets, and C is a set of edges defining binary constraints between pair of nodes. In particular, each edge in C from a tweet node T i to a tweet node T j defines an authorship constraint for T i deriving from its relation with T j . Each edge in C is represented as a tuple: T i , T j , C i j , where C i j is an authorship constraint as defined below.

Definition 4 (Authorship Constraint)
Given two tweet nodes T i and T j , an authorship constraint C i j from T i to T j is represented as a set of tuples {(u h , [s h , e h ]), . . . }, called authorship statements, where u h ∈ U is a user involved in the authorship of T i and [s h , e h ] ∈ R 2 is the corresponding degree of ownership. Each degree of ownership is represented as an interval of likelihood which extends from a minimum of s h to a maximum of e h .
The following constraints are defined on the authorship statements composing an author- In other words, the minimum likelihood of each authorship statement has to be greater than or equal to 0 (Eq. 2); the degree of ownership has to be a valid interval (Eq. 3), while the sum of the maximum likelihood has to be equal to 1 (Eq. 4).

Proposed solution
This section illustrates the three algorithmic contributions of the paper: (i) the definition of a procedure for building a PCN given a set of general tweets and retweets (Sect In the next sections, we will refer to the following running example in order to better illustrate the PCN construction procedure and the constraint propagation operations.

Example 1
Let us consider a set T containing two general tweets, T 1 and T 2 , and five retweets, RT 1 , RT 2 , RT 3 , RT 4 and RT 5 . Their details are summarized in Table 1 where ID is the tweet identifier, user is the identifier of the user who posted the tweet, timestamp is the tweet timestamp, and retweet-of contains the identifier of the original tweet, if the current tweet is a retweet, or is left empty otherwise. In this case, RT 1 , RT 2 , RT 3 and RT 4 are retweets of T 1 , while RT 5 is a retweet of T 2 .

Construction of a PCN
Given a collection T including both general tweets and retweets regarding a considered period of time, a PCN N can be built by performing the operations summarized in Alg. 1. The definition of the following transformation rules is the second contribution of the paper and is an essential preparatory step for all the other operations. First of all, the set X of nodes for the network N is initialized (see line 4).

Definition 5 (PCN Node)
Given a collection T of tweets, a node n is created and added to the network N for each T ∈ T .
Given the situation introduced in Ex. 1, a node is created for each row of Table 1, as depicted in Fig. 2.
Once the set of nodes X of N has been built, we connect them by considering: (i) the link between a retweet and its original tweet, (ii) the temporal and social relations among the retweets of the same tweet, and (iii) the temporal connections among the tweets of the same authors.
Before proceeding with the edge definition, we introduce the notion of Candidate Retweet Sources (CRS) as the set of all tweets which can be considered a valid source for a current retweet R.  Table 1 Definition 6 (Candidate retweet sources) Given a retweet R ∈ R, the set of candidate retweet sources (CRS) S is defined as: In other words, besides to the original tweet T = R.retweet_of, the CRS contains all the other retweets of T which can be considered a source for R based on their social and temporal relations.
Given a retweet R, each connection between R and an element S in S can be weighted based on (i) the number of elements in S and (ii) the temporal distance between R and S. Definition 7 (Interaction weight) Given a retweet R and its set of candidate retweet sources S, the interaction weights between R and any element S ∈ S is computed in the following way: (i) for each S ∈ S the relative temporal distance between R and S is determined as: then (ii) u rs is transformed in order to obtain a weight which is inversely proportional to the computed temporal distance and such that the sum of all the weights is equal to 1: The interaction weights have been normalized for using it as components of authorship statements, as we will see in the following definitions.
The first kind of edge to be built is the one connecting each retweet RT to its original tweet T (see Alg. 1 line 9).

Definition 8 (R-T Edge)
Given a general tweet T ∈ T \R and the set T .R of its retweets, for each R ∈ T .R an edge is added from R to T and labeled with the authorship constraint: where the value w rt is computed as in Eq. 7 of Def. 7.
As you can notice, in case more than one possible sources are available for R, the initial minimum likelihood is set equal to the interaction weight between R and T . Indeed, in line to what has been mentioned in Observation 3.1, the likelihood interval associated to each edge has to be inversely proportional to the temporal distance between the two nodes, so that the tweet, which is temporally closest to R, has a greater value for the minimum likelihood. Conversely, in case the only possible source for R is represented by the original tweet T , the initial minimum likelihood is set equal to 0 with the aim to promote the following constraint propagation process. Finally, the initial value for the maximum likelihood is set equal to 1 at the beginning, since no additional information is available and we need to satisfy Eq. 4.
Relatively to the network in Fig. 2, we have five edges of this kind. They are depicted with a solid line (i.e., A, B, E, H and I ), and their constraint labels are reported in Table 2.
Definition 9 (R-R Edge) Given a tweet T ∈ T \R and the set T .R of its retweets, an edge is added from R i ∈ T .R to R j ∈ T .R if and only if R j ∈ R i .Friends and R j .timestamp < R i .timestamp. The label associated to this edge will contain the authorship constraint: Algorithm 1 Construction of a PCN N starting from a set of tweets T .
if S = ∅ then 12: for S ∈ S do 13: if |S| = 1 then 14: m ←− 0 15: for end for 28: return N 29: end function where the value w r i r j is computed as in Eq. 7 of Def. 7.
The same considerations made in Def. 8 relatively to the authorship constraint are also valid here. This kind of edges are depicted with dashed lines in Fig. 2 (i.e., C, D, F, G, L) and the constraint values are reported in Table 2.
The set of edges introduced until now has the effect to build a set of independent subnetworks, one for each original tweet T . The last kind of edge is the one which provides a link between different sub-networks, since it connects tweets performed by the same author and could be useful in order to strengthen the social relationships between users (see Alg. 1 lines 23-27).

Definition 10 (T-T Edge)
Given two tweets T i , T j ∈ T , an edge is added from T i to T j if and only if T i .user = T j .user and T j .timestamp < T i .timestamp. The edge will be labeled with the following constraint: This last kind of edge is depicted in Fig. 2 as red dot-dashed lines (i.e., X , Y ), while the associated constraints are reported in Table 2. As you can notice, the resulting PCN is composed of different sub-networks, each one originating from a different source tweet, which are connected with each other through T-T edges.
Given a PCN, some constraint propagation operations can be performed in order to reduce the uncertainty associated to the degree of ownership of each user appearing in a constraint. More specifically, the Path Consistency Algorithm [10] can be applied; it relies on the conjunction and compositions operations, which are redefined on authorship constraints in the following section.

Constraint propagation
The Path Consistency Algorithm [10] is a classical technique used for constraint propagation with the main aim to reduce the variable domains after the arc-consistency is performed. In a PCN, such algorithm can be used to propagate the authorship and restrict the interval of likelihood associated to each user inside a constraint, namely to provide a more precise measure of their degree of ownership. The idea behind the Path Consistency Algorithm is very simple, given three nodes x i , x j and x k , such that there exists a constraint C i j between x i and x j , a constraint C ik between x i and x k , and a constraint C k j between x k and x j that completes the triangle, a new constraint can be derived between x i and x j by properly combining them.

Definition 11 (Path Consistency Algorithm)
Given three nodes x i , x k and x j of a PCN N , a new constraint between x i and x j can be derived from the existing constraints by the path consistency algorithm as follows: where C i j is the constraint existing between x i and x j , C ik • C k j is the composition of two constraints, and C i j ⊗ C is the conjunction.
In order to actually apply the path consistency algorithm to a PCN N , it is necessary to define the operations of inversion, conjunction and composition between authorship constraints. The definition of these operations is the third contribution of the paper: they are essential for applying the constraint propagation and the derivation of new provenance knowledge.
The inversion operation could be particularly useful during the constraint propagation task, since in order to identify a possible reduction triangle, the inverse of a constraint can be required, as illustrated in the following example.  [a 1 , b 1 ]), . . . , (x n , [a n , b n ])} and C k j = {(y 1 , [c 1 , d 1 ]), . . . , (y m , [c m , d m ])}, their composition C ik • C k j is defined as follows: In other words for each user appearing in both the original constraints, the degree of ownership in the composed constraint is the sum of the two degrees of ownership; otherwise, for each user appearing in only one of the two constraints, denoted as c (or d), the degree of ownership in c (or d) becomes the degree of the composed constraint.
In other words, the conjunction operation computes, for each user u belonging to the set of friends of the source user u i , the corresponding degree of ownership as follows: if u appears in both the considered constraints, their degrees of ownership are summed; otherwise, if u appears only in one of the two constraints, its original degree of ownership is taken. The previous examples bring out the fact that the resulting constraint could not satisfy Eq. 4. Therefore, the following normalization operation is needed in order to complete the propagation and produce the final result.
As you can notice from the PCN in Fig. 2, we can identify triangles for the application of the Path Consistency Algorithm only inside the same sub-network. Conversely, T-T edges (like X and Y ) which connect two distinct sub-networks are never part of an interesting triangle. Indeed, possible triangles could involve: (i) nodes contained inside the same subnetwork, or (ii) nodes contained in different sub-networks and connected through only T-T edges. In the last case, the nodes are related to the same user u and the constraints have all the form (u, [1,1]), so no actual propagation can be performed. However, T-T edges can be useful for identifying the strength of the social connection between authors. Let us consider the situation in Fig. 2, we can observe that edges X and Y connect two sub-networks by linking two nodes related to u 2 and two nodes of u 3 , respectively. Moreover, u 2 and u 3 are connected in both sub-networks, creating together a loop. This situation identifies a stronger connection between u 2 and u 3 , because there is more than one case in which they are socially connected.
In order to exploit such kind of connections, we need to formalize the notion of PCN sub-network and PCN loop.

Definition 16 (PCN sub-network)
Given a PCN N = X , C , a sub-network M = Y, D of N can be defined as follows: With reference to the PCN depicted in Fig. 2, two sub-networks can be identified:

Definition 17 (PCN loop) Given a PCN N in which we can identify two sub-networks M i and M j , a loop is a tuple
x h , x k , x m , x n ∈ X 4 (18) such that: In Fig. 2 nodes RT 2 , RT 3 , RT 5 , T 2 form a loop, indeed (i) RT 2 , RT 3 ∈ M 1 are connected through an R-R edge in M 1 , (ii) RT 5 , T 2 ∈ M 2 are connected through an R-T edge in M 2 , (iii) while T 2 and RT 2 have the same author (i.e., u 2 ) and are connected through a T-T edge, and finally, RT 5 and RT 3 have the same author (i.e., u 3 ) and are connected through a T-T edge.
We can use the presence of a loop for increasing the degree of ownership of the referenced user inside the constraints of each sub-network, as described below.
Definition 18 (enhancement) Given a network N and two users u i , u j ∈ U such that L i j is the set of loops involving u i and u j : where M i and M j are two sub-networks of N . For each constraint C ∈ N · C from node x i to node x j such that the author of x i is u i and the author of x j is u j (or vice versa), the degree of ownership associated to u j in C can be enhanced by a weight e i j computed as: where N · C i is the set of edges in N which involve the node x i .

Example 9
Let us consider the situation in Fig. 2  Given the above definitions, a constraint propagation algorithm can be applied inside and outside the sub-networks of N . Once the propagation has been done, the resulting network contains in each R-T edge an authorship constraint describing all the possible source of authorship for the source node. More specifically, with reference to the situation in Ex. 9, after the application of the constraint propagation algorithm, the edge A will finally contain the following constraint: which means that as regards to the retweet RT 2 posted by u 2 , the users involved in its social provenance are: u, u 1 and u 3 . The greater degree of ownership is associated to u 3 , even if the temporal distance between RT 2 and RT 1 is less than the temporal distance between RT 2 and RT 3 . This is also due to their social interaction provided by the presence of the PCN loop. Conversely, u 1 has a degree of ownership greater than to u, due to the smaller temporal distance between the two retweets.
Given all these considerations, the following section presents a MapReduce implementation of the constraint propagation procedure which includes both the computation of the enhancements and the parallel application of the Path Consistency Algorithm.

MapReduce constraint propagation
The classical Path Consistency Algorithm is characterized by a high computational complexity which makes its application unpractical in many real-world problems. Indeed, its theoretical complexity is equal to O(n 3 k 5 ), where n is the number of nodes and k is the number of edges. However, as we have already observed in the previous section, a PCN is typically composed of several highly-connected sub-networks which can be linked together by T-T edges which do not directly participate to the constraint propagation. This particular structure of a PCN suggests that the constraint propagation can be actually performed by considering each sub-network alone in a parallel way.  Therefore, we assume that the overall network N produced by Alg. 1 has been stored as two separated outputs: (i) one containing the subnetworks that will become the input of the path consistency job in Alg. 3 as we will discuss later, and (ii) one containing the loops L which connect the distinct subnetworks. This last output is useful for computing the social interactions between pairs of users, and we use them inside the MapReduce job in Alg. 2.

Algorithm 3 Job providing a MapReduce implementation of the Constraint Propagation
Algorithm on a PCN. In more details, in the job of Alg. 2, each mapper receives and processes a subset L i of the network loops L and essentially counts the user interactions contained in it (lines [6][7][8][9][10][11][12][13][14][15][16][17][18]. This counter is stored into an auxiliary data structure E, which is initialized in the setup method. Each L i represents a split in the MapReduce terminology (see Alg. 2 line 3). Each mapper has a complexity equal to O(|L i |), namely equal to the number of loops contained inside the same split L i .

Algorithm 4 Mapper class implementing the operations to be performed in parallel on each sub-network
end function 9: function cleanup( ) 10: while Q = ∅ do 12: end for 24: end function 25: end procedure Algorithm 5 Function for the computation of the triangles involving nodes in a network N .
The reducer (line 20-27) simply combines the partial results by summing-up the partial counters produced by the mappers for each pair of users. The final output is an associative array which returns for each pair of users a value representing the number of loops involving them. The reducer has a complexity equal to O(|U| × |U|), namely equal to the number of possible pairs of users, since it has to process each of them for computing the final result.
Given the computation of the enhancement weights, we can proceed with the definition of the MapReduce job for the constraint propagation. The overall job is reported in Alg. 3 and assumes that the network N has been subdivided into a set of splits {M 1 , . . . M m }, each one representing a distinct subnetwork, by using an appropriate partitioning technique [24,25]. The job is also aware of the associative array E which has been computed by the previous job and has been stored as a configuration parameter for latter uses inside the reduce phase. Finally, the set of loops L is given in order to finally reconstruct the overall network.
The implementations of the map and reduce phases of the job are illustrated in Alg. 4 and 6, respectively. The mappers assume that a sub-network is represented as a set of records with the form x i , x j , C i j where x i is the source node, x j is the target node and C i j ∈ N .C is the constraint between x i and x j . Alg. 4 illustrates the operations performed by the mappers on each sub-network M i ∈ N . During a preliminary setup, an auxiliary data structure M is initialized: it will be populated inside the map method by storing each edge in M i as well as its inverse in an associative way. This data structure is particularly useful for the application of the path consistency algorithm, which is actually performed inside the cleanup. An auxiliary function, called triangles, is used to identify the possible triples of nodes on which the constraint propagation can be performed. Notice that at the end of the map phase, the computation of the enhancement weights is completed by dividing the value stored in E during the previous task by the number of edges involving the source node as in Eq. 21. The complexity of each mapper is dominated by the application of the classical Path Consistency Algorithm during the cleanup phase. Even if its complexity remains O(n 3 i k 5 i ), we can observe that in real-world applications n i n and k i k, namely the number of nodes and edges contained in each sub-network is typically much less than the number of nodes and edges in the overall network. This has also some consequences on the scalability of the approach: an eventual increment in the network size is usually due to an increment of the number of sub-networks rather than an increment of their respective sizes.

Algorithm 6
Reducer class implementing the operations necessary to recombine the updated sub-networks and properly enhancing the user connections.
The reducer is illustrated in Alg. 6; it is responsible for rebuilding the overall network starting from the partial results produced by the maps. More specifically, it writes back the updated edges contained inside each subnetwork (i.e., the output produced by the mappers), after having properly enhanced them through the weights contained in the map E (see Alg. 6 line 5). After the enhancement of each authorship statement, a normalization of the overall constraint is performed in order to guarantee the satisfaction of Eq. 4. Notice that more than one reducer can be executed in parallel in order to produce the final result. The complexity of each reducer is O( |M i .C|/r ), where r is the total number of instantiated reducers: each reducer receives a portion of the edges computed by all the mappers (i.e., a portion of the edges contained in the sub-networks).  The last operation to be performed for completing the network reconstruction is the output of the T-T edges which connect different subnetworks and are not processed by the mappers. This is performed at the end of the main job (see Alg. 3 line 6) after the reducers completion.

Case study
For the experimental phase, we consider a portion of dataset provided in [26] which contains a large collection of COVID-19 related tweets collected starting from January 2020. Since this dataset contains only synthetic data, it has been properly enriched (hydrated) to retrieve the necessary information, such as the indication of whether a post is a retweet or not, its timestamp and the reference to the original tweet, the user id and the list of her followers.
Given the mentioned set of tweets, we have extrapolated five different datasets with increasing sizes, in order to test the performances of the proposed approach. Table 3 reports the overall characteristics of these datasets such as the spanning time, the number of rows and the number of users.
Given the five datasets reported in Table 3, the procedure illustrated in Alg. 1 has been applied in order to obtain the corresponding PCNs. Table 4 reports some characteristics of the obtained networks, in particular: the number of nodes, the number of edges and the number of contained subnetworks. Notice that in the identification of the sub-networks, those with less than three nodes have been discarded, since they cannot contain any triangle useful for the propagation.
Finally, Table 5 reports some summary information about the subnetworks and the HDFS splits containing them. As discussed in [24], in order to better exploit the advantages induced by a MapReduce approach, it is necessary that the applied partitioning technique creates balanced splits, which means having a uniform amount of work to be done in parallel by each mapper. In our case, this can happen only if the identified sub-networks have substantially a similar size. For this reason Table 5 reports some statistics about the obtained splits, such as the minimum, maximum and average number of edges (rows in the splits) as well as the relative standard deviation between the split sizes. From the obtained results, we can observe that at first glance the subnetworks are not well balanced. There are some very small subnetworks (i.e., with very few edges) and others that are very big. However, the average size and the average relative standard deviation indicate us that on average the size of the various subnetworks (i.e., the split sizes) does not differ more than 4 times. In other words, the number of sub-networks containing the minimum or the maximum amount of edges (outliers) is very small, while the others have a comparable size (i.e., the same order of magnitude), even if not exactly the same.

Evaluation metrics
Evaluating the correctness of the derived information about social provenance is not a trivial task: as already highlighted in previous works, the absence of ground truth information prevents the use of standard evaluation metrics. In this paper we use an approach similar to the one applied in [8,27], which consists in the definition of a set of metrics. However, in this case since we try to identify and evaluate all the possible provenances of a given post, the defined metrics cannot be directly applied and we have to slightly modify them. The definition of the following evaluation metrics is the last contribution of the paper. They represent an important tool for evaluating the performances of the approach in absence of a base truth.
where for each constraint C ∈ C the value |C| is the number of authorship statements in C.
In the proposed approach, the network obtained after the constraint propagation has an ACS higher than the one of the original network. Indeed, at the beginning, the network will contain only one authorship statement for each constraint. Conversely, after the application of the constraint propagation, more statements should be added in each constraint, meaning that additional information is now available. Definition 20 (Sparse node incidence) Given a PCN N = X , C the Sparse Node Incidence (SPI) is the number of retweets whose constraint size (i.e., number of statements in the constraint) is equal to one, divided by the overall number of retweets: where x · type returns the type associated to a node x ∈ X , namely RT in case of a retweet or T in case of a general tweet.
Sparse nodes are essentially nodes with only a connection to the original tweet, without any other possible connection derivable from temporal and social relationships. Since the objective of the proposed technique is estimating possible chains of retweets starting from the partial information provided by the Twitter API, decreasing the incidence of the sparse node means increasing the amount of available information.
Definition 21 (Retweet source incidence) Given a PCN N = X , C , the Retweet Source Incidence (RSI) is the number of constraints in which the degree of ownership associated to a retweet source (i.e., derived connection) is greater than the degree of ownership associated to the original tweet, divided by the overall number of retweets. Given the set RT defined as: which contains the set of R-T edges such that the minimum degree of ownership associated to a user different from the original tweet author u, is greater than the degree of ownership associated to u. The metric RS I can be computed as This last metric is used to identify the number of cases in which the proposed technique is able to identify an alternative source for a retweet which is more likely than the original tweet.

Result evaluation
Given the datasets described in Table 3 and the PCNs illustrated in Table 4, the proposed constraint propagation technique has been applied and the evaluation metrics introduced in Sect. 5.1 have been computed on the resulting networks. The source code has been made publicly available. 2 and the tests have been performed on a Hadoop Cluster composed of 10 slaves nodes and 1 master node. The results are reported in Table 6 where each column reports the value of the corresponding metric.
The results in Table 6 show that even if in the obtained networks some sparse nodes remain (i.e., SPI metric), namely some retweets continue to be connected only to the original tweet, the average constraint size becomes greater than one (i.e., ACS metric). In other words, each non-sparse retweet has been associated to at least another possible source, beside to the original tweet, and the number of cases in which such additional sources have a minimum degree of ownership greater than the original one exceeds the 50%, reaching in some cases the 74% (i.e., RSI metric). Finally, the results in Table 7 report some information about the performances of the proposed algorithm: the total time taken by the job to complete, some statistics about the execution time of the map tasks, and some statistics about the number of iterations. As regards to the amount of time taken by map tasks, we can observe that even if the splits are not completely balanced, the difference between their minimum and maximum execution time is reasonable and very near to the average. The columns labeled as Iterations report the number of iterations performed by the Path Consistency Algorithm to achieve convergence. This number is small and on average three or four iterations are sufficient to complete the constraint propagation.

Comparison and possible applications
As already discussed, the main difference between the proposed solution and the state of the art resides on the fact that the former tries to identify all the possible connections and assigns them a different likelihood measure based on temporal and social relations. Conversely, the latter ones search for only the most likely source, eventually missing possible important connections.
Despite this difference, we can observe that given the PCN resulting from the execution of Alg. 3, it is always possible to retrieve a single chain of retweet by considering for each retweet only the connection induced by the authorship statement with the greatest minimum degree of ownership. More specifically, as highlighted in Sect. 4.3, after the constraint propagation, the edge between a retweet R and its original tweet T is characterized by an authorship constraint containing an authorship statement for each possible source with the corresponding degree of ownership. Starting from these R-T edges and considering only the authorship statements with the greatest minimum degree of ownership, it is possible to identify the most likely connection and build a simple chain of retweet as the one proposed in [8]. In other words, the proposed solution is not only more informative than the existing ones, since it provides a more complete description about the situation, but it is also flexible enough to be reduced to a classical graph.   Table 8 which have been obtained after the application of the constraint propagation to the PCN in Fig. 2. By considering the obtained R-T edges and by identifying inside them the most likely authorship statement, we can identify the chain of retweet highlighted in Fig. 3. We take as more likely authorship statement the one with the greatest lower bound in the degree of ownership.
The provided solution can be a more suitable starting point for subsequent analysis. Let us consider for instance the identification of the so called influencer for a given topic, namely the set of users whose contents are the most followed with reference to a given argument. Similarly, given a certain user u who retweeted many posts regarding a certain arguments, we can identify that even if the original tweets came from several different sources, u actually may take them from only one friend. If we consider only the most likely connection, these analysis can be compromised, because in some cases the identification of the influencers can pass through connections which are not the most likely, as illustrated in the following example.

Example 11
Let us consider the portion of PCN depicted in Fig. 4 where we have 4 tweets regarding the same topic and the set of their retweets. For not cluttering the notation we have labeled only the R-T edges, since after the constraint propagation we will consider only their constraints in order to reconstruct the possible retweet sources.
Suppose that we are interested in discovering the behavior of user u r 2 . At first glance, we could observe that u r 2 has performed several retweet activities by considering various sources of information, and in particular user u 1 , u 2 , u 3 and u r 3 . Conversely, if we apply the constraint propagation algorithm, we obtain the following authorship constraints for the and we can observe that there is a user in common in all the authorship constraints, namely u r 3 . Therefore, it is more likely that u r 2 actually takes as his/her source of information u r 3 , instead of several sources. This connection could be missed in case we apply a traditional reconstruction approach, since u r 3 is not associated to the authorship statement with the greatest degree of ownership (due to the relative temporal distance the most likely connection is the RT 3 ), so this connection will be likely discarded.
inference of the social provenance and also further analysis about user interactions and the mutual influence among users. For all these reasons, this paper provides an innovative solution for generating a complete retweet cascade graph, which differs from the other available approaches since it tries to reconstruct all possible connections between tweets and assigns them a weight proportional to their temporal and social relationship. This approach is based on the notion of Provenance Constraint Network (PCN), a data structure inspired by the well-known Temporal Constraint Network, and an adapted version of the Path Consistency Algorithm for authorship constraint propagation. A MapReduce implementation of the proposed technique is provided and an experimentation on a real-world dataset is presented. The obtained results highlight the potentiality of the proposed approach in particular as regards to the possibility to apply more refined analysis. As future work we plan to investigate our approach combined with sentiment analysis techniques, in order to consider their potentialities in the analysis of textual contents of tweets and quotes and for refining the concept of social interaction between users.
Author Contributions All authors contributed equally to this work.
Funding Open access funding provided by Università degli Studi di Verona within the CRUI-CARE Agreement.
Data availability For the experimental phase, we consider a portion of dataset provided in [26] which contains a large collection of COVID-19-related tweets collected starting from January 2020.

Code Availability
The source code is available at https://github.com/smigliorini/pcn.

Conflict of interest
The authors have no competing interests to declare that are relevant to the content of this article.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/. Elisa Quintarelli obtained her PhD in Computer and Automation Engineering at Politecnico di Milano. She is now an Associate Professor at Università di Verona. She is the author of about 80 papers and her research interests are in databases, with a focus on big data, intentional query answering, data mining and context-based personalization. She is part of the Program Committee of International Conferences and reviewer for International Journals.